home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / archival / ftp / BFTP.312 / tool_lib.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-29  |  35.3 KB  |  1,455 lines

  1. /* tool_lib.c */
  2.  
  3. #include <ctype.h>
  4. #include <stdio.h>
  5.  
  6. #include <suntool/sunview.h>
  7.     /* includes <sunwindow/window_hs.h>, which includes <sys/time.h> */
  8. #include <suntool/panel.h>
  9. #include <suntool/textsw.h>
  10.  
  11. #include <sys/param.h>
  12.  
  13. #include "bftp.h"
  14.  
  15. extern Frame tool_frame;
  16.  
  17. Menu     src_file_menu,
  18.     save_menu,
  19.     port_menu,
  20.     host_menu,
  21.     dir_menu,
  22.     login_menu,
  23.     passw_menu;
  24.  
  25. char     def_dir[100],
  26.     def_passwd[80];
  27.     
  28. extern void 
  29.       copy_screen(),
  30.     show_dest_file();
  31. extern char
  32.     bftp_dir[MAXPATHLEN],
  33.     def_hostname[80],
  34.     def_user[20],
  35.     *malloc(),
  36.     **get_save_files();
  37. extern boolean 
  38.       empty_str();
  39.  
  40. extern struct hint_record {
  41.   Panel_item *field_item, *msg_item;
  42.   void (*event_proc)();
  43. } hint_list[];
  44.  
  45. extern struct help_record {
  46.    union u_tag {
  47.      Panel_item *ip;
  48.      char    *cp;
  49.      } uval;
  50.    } helplist[1000];
  51.  
  52. #define set_ptr(item) helplist[i++].uval.ip = &item
  53. #define set_str(str) helplist[i++].uval.cp = str
  54. #define last_str() helplist[i++].uval.cp = NULL
  55.  
  56. Window h_frame;
  57.    
  58. static void
  59. delete_help(window, event, arg)
  60.    Window window;
  61.    Event *event;
  62.    caddr_t arg;
  63. {
  64.    if (event_id(event) == MS_MIDDLE && event_is_up(event)) {
  65.       window_set(h_frame,
  66.               WIN_GRAB_ALL_INPUT,     FALSE,
  67.         0);
  68.       window_destroy(h_frame);
  69.       }
  70.    else
  71.       window_default_event_proc(window, event, arg);
  72. }
  73.  
  74. static void
  75. help_proc(item, event)
  76.    Panel_item item;
  77.    Event *event;
  78. {
  79.    int i = 0, j = 0;
  80.    Window h_panel;
  81.  
  82.    if (event_id(event) == MS_MIDDLE && event_is_down(event))
  83.       while (helplist[i].uval.ip) {
  84.      if (item == *helplist[i++].uval.ip) {
  85.         if (h_frame = window_create(tool_frame, FRAME,
  86.                    FRAME_SHOW_LABEL,    FALSE,
  87.             FRAME_NO_CONFIRM,     TRUE,
  88.             WIN_EVENT_PROC,         delete_help,
  89.                 WIN_X,             0,
  90.                 WIN_Y,             0,
  91.             0)
  92.         ) {
  93.            h_panel = window_create(h_frame, PANEL, 0);
  94.            j = 0;
  95.            while (helplist[i].uval.cp) {
  96.           panel_create_item(h_panel, PANEL_MESSAGE, 
  97.                 PANEL_LABEL_X,        ATTR_COL(0),
  98.                 PANEL_LABEL_Y,          ATTR_ROW(j++),
  99.                 PANEL_LABEL_STRING,     helplist[i++].uval.cp, 
  100.             0);
  101.           }
  102.            window_fit(h_panel);
  103.            window_fit(h_frame);
  104.            window_set(h_frame, 
  105.               WIN_SHOW,         TRUE, 
  106.               WIN_GRAB_ALL_INPUT,     TRUE,
  107.               0);
  108.            }
  109.         break;
  110.         }
  111.      else
  112.         while (helplist[i].uval.cp)
  113.           i++;
  114.      i++;
  115.          }
  116. }
  117.  
  118. /* Event Procs */
  119.  
  120. void
  121. dummy_event_proc(item, event)
  122.    Panel_item item;
  123.    Event *event;
  124. {
  125.    help_proc(item, event);    
  126.    panel_default_handle_event(item, event);
  127. }
  128.  
  129. void
  130. no_spaces(item, event)
  131.    Panel_item item;
  132.    Event *event;
  133. {
  134.    help_proc(item, event);
  135.    if (event_is_ascii(event) && ' ' == (char)event_id(event))
  136.       window_bell((Panel)panel_get(item, PANEL_PARENT_PANEL));
  137.    else
  138.       panel_default_handle_event(item, event);
  139. }
  140.  
  141. void
  142. make_bold(item, event)
  143.    Panel_item item;
  144.    Event *event;
  145. {
  146.    help_proc(item, event);
  147.    if (event_is_ascii(event))
  148.       if (' ' == (char)event_id(event))
  149.      window_bell((Panel)panel_get(item, PANEL_PARENT_PANEL));
  150.       else  {
  151.      panel_default_handle_event(item, event);
  152.      panel_set(item, PANEL_LABEL_BOLD,
  153.               (strlen((char *)panel_get(item,PANEL_VALUE)))?TRUE:FALSE,
  154.         0);
  155.          }
  156.    else
  157.       panel_default_handle_event(item, event);
  158. }
  159.  
  160. void
  161. check_decimal(item, event)
  162.    Panel_item item;
  163.    Event *event;
  164. {
  165.    help_proc(item, event);
  166.    if (event_is_ascii(event) &&
  167.        ! isdigit((char)event_id(event)) &&
  168.        ! iscntrl((char)event_id(event)) )
  169.       window_bell((Panel)panel_get(item, PANEL_PARENT_PANEL));
  170.    else
  171.       panel_default_handle_event(item, event);
  172. }
  173.  
  174. /* Menu containing names of save files -- MENU_GEN_PROC */
  175.  
  176. static Menu
  177. save_file_proc(m, operation)
  178.    Menu m;
  179.    Menu_generate operation;
  180. {
  181.    char **list;
  182.     
  183.    switch(operation) {
  184.       case MENU_DISPLAY:
  185.          list = get_save_files();
  186.          while (*list)
  187.         menu_set(m, MENU_STRING_ITEM, *list++, 0, 0);
  188.      break;
  189.  
  190.       case MENU_DISPLAY_DONE:
  191.       case MENU_NOTIFY:
  192.       case MENU_NOTIFY_DONE:
  193.      break;
  194.       }
  195.    return(m);
  196. }
  197.  
  198. /* PANEL_EVENT_PROC */
  199.  
  200. static void
  201. display_save_menu(item, event)
  202.    Panel_item item;
  203.    Event *event;
  204. {
  205.    Menu_item *mi;
  206.  
  207.    help_proc(item, event);
  208.    if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  209.       if (NULL !=
  210.             (mi = (Menu_item *)menu_show(save_menu, 
  211.               (Panel)panel_get(item, PANEL_PARENT_PANEL), 
  212.             event, 0)))
  213.          panel_set_value(item, (char *)menu_get(mi, MENU_STRING));
  214.       menu_destroy(save_menu);
  215.       save_menu = menu_create(MENU_GEN_PROC,    save_file_proc,
  216.                    MENU_NOTIFY_PROC, menu_return_item,
  217.                   0);
  218.       }
  219.    else
  220.       if (event_is_ascii(event) &&
  221.           ('-' != (char)event_id(event)) &&
  222.       ('.' != (char)event_id(event)) &&
  223.       (ispunct((char)event_id(event)) || (' ' == (char)event_id(event))))
  224.          window_bell((Panel)panel_get(item, PANEL_PARENT_PANEL));
  225.       else
  226.          panel_default_handle_event(item, event);
  227. }
  228.  
  229. /* PANEL_EVENT_PROC */
  230.  
  231. static void
  232. display_host_menu(item, event)
  233.    Panel_item item;
  234.    Event *event;
  235. {
  236.    Menu_item *mi;
  237.  
  238.    if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  239.       if (NULL !=
  240.             (mi = (Menu_item *)menu_show(host_menu, 
  241.               (Panel)panel_get(item, PANEL_PARENT_PANEL), 
  242.             event, 0)))
  243.          panel_set_value(item, (char *)menu_get(mi, MENU_STRING));
  244.       }
  245.    else
  246.       no_spaces(item, event);
  247. }
  248.  
  249. void
  250. display_login_menu(item, event)
  251.    Panel_item item;
  252.    Event *event;
  253. {
  254.    Menu_item *mi;
  255.  
  256.    if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  257.       if (NULL !=
  258.             (mi = (Menu_item *)menu_show(login_menu, 
  259.               (Panel)panel_get(item, PANEL_PARENT_PANEL),
  260.             event, 0)))
  261.          panel_set_value(item, (char *)menu_get(mi, MENU_STRING));
  262.       }
  263.    else
  264.       no_spaces(item, event);
  265. }
  266.  
  267. void
  268. display_passw_menu(item, event)
  269.    Panel_item item;
  270.    Event *event;
  271. {
  272.    Menu_item *mi;
  273.    char *cp;
  274.  
  275.    if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  276.       if (NULL !=
  277.             (mi = (Menu_item *)menu_show(passw_menu, 
  278.               (Panel)panel_get(item, PANEL_PARENT_PANEL), 
  279.             event, 0))) {
  280.      cp = (char *)menu_get(mi, MENU_STRING);
  281.          panel_set(item,
  282.          PANEL_VALUE,         cp,
  283.         PANEL_LABEL_BOLD,    (strlen(cp)?TRUE:FALSE),
  284.         0);
  285.      }
  286.       }
  287.    else
  288.       make_bold(item, event);
  289. }
  290.  
  291. void
  292. display_dir_menu(item, event)
  293.    Panel_item item;
  294.    Event *event;
  295. {
  296.    Menu_item *mi;
  297.    char *cp;
  298.  
  299.    if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  300.       if (NULL !=
  301.             (mi = (Menu_item *)menu_show(dir_menu, 
  302.               (Panel)panel_get(item, PANEL_PARENT_PANEL), 
  303.             event, 0))) {
  304.      cp = (char *)menu_get(mi, MENU_STRING);
  305.          panel_set(item,
  306.          PANEL_VALUE,         cp,
  307.         0);
  308.      }
  309.       }
  310.    else
  311.       no_spaces(item, event);
  312. }
  313.  
  314. void
  315. display_port_menu(item, event)
  316.    Panel_item item;
  317.    Event *event;
  318. {
  319.    Menu_item *mi;
  320.  
  321.    if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  322.       if (NULL !=
  323.             (mi = (Menu_item *)menu_show(port_menu, 
  324.               (Panel)panel_get(item, PANEL_PARENT_PANEL), 
  325.             event, 0))) {
  326.          panel_set(item,
  327.          PANEL_VALUE,         (char *)menu_get(mi, MENU_STRING),
  328.         0);
  329.      }
  330.       }
  331.    else
  332.       check_decimal(item, event);
  333. }
  334.  
  335. void
  336. hint_event_proc(item, event)
  337.      Panel_item item;
  338.      Event *event;
  339. {
  340.    int i;
  341.    boolean match = FALSE;
  342.  
  343.    if (event_is_ascii(event) || event_is_button(event)) {
  344.       for (i=0; hint_list[i].field_item ; i++)
  345.      /* find the matching entry */
  346.      if (item == *hint_list[i].field_item) {
  347.         /* make the hint disappear */
  348.         panel_set(*hint_list[i].msg_item, PANEL_SHOW_ITEM, FALSE, 0);
  349.         /* perform the procedure found in the hint_list structure */
  350.         (*hint_list[i].event_proc)(item, event);
  351.         /* if the field is empty, put the hint back */
  352.         if (!strlen((char *)panel_get(item, PANEL_VALUE)))
  353.            panel_set(*hint_list[i].msg_item, PANEL_SHOW_ITEM, TRUE, 0);
  354.         break;
  355.         }
  356.       }
  357.    else
  358.       panel_default_handle_event(item, event);
  359. } /* hint_event_proc */
  360.  
  361. extern Panel_item sFile_item;
  362.  
  363. /* Menu containing source file name; used to fill in destination file. */
  364.  
  365. static Menu
  366. src_file_proc(m, operation)
  367.    Menu m;
  368.    Menu_generate operation;
  369. {
  370.    char *cp, *sfp;
  371.  
  372.    switch(operation) {
  373.       case MENU_DISPLAY:
  374.            if (!empty_str(sfp = (char *)panel_get(sFile_item, PANEL_VALUE))) {
  375.         cp = malloc(strlen(sfp));
  376.         strcpy(cp, sfp);
  377.         menu_set(m, MENU_STRING_ITEM, cp, 0, 0);
  378.         }
  379.      break;
  380.  
  381.       case MENU_DISPLAY_DONE:
  382.       case MENU_NOTIFY:
  383.       case MENU_NOTIFY_DONE:
  384.      break;
  385.       }
  386.    return(m);
  387. } /* src_file_proc */
  388.  
  389. void
  390. display_sfile_menu(item, event)
  391.    Panel_item item;
  392.    Event *event;
  393. {
  394.    Menu_item *mi;
  395.  
  396.    if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  397.       if (NULL !=
  398.       (mi = (Menu_item *)menu_show(src_file_menu, 
  399.             (Panel)panel_get(item, PANEL_PARENT_PANEL), 
  400.             event, 0)))
  401.      panel_set_value(item, (char *)menu_get(mi, MENU_STRING));
  402.       menu_destroy(src_file_menu);
  403.       src_file_menu = menu_create(MENU_GEN_PROC,    src_file_proc,
  404.                     MENU_NOTIFY_PROC,     menu_return_item,
  405.                     0);
  406.       }
  407.    else
  408.       no_spaces(item, event);
  409. } /* display_sfile_menu */
  410.  
  411. void
  412. init_port_menu()
  413. {
  414.    port_menu = menu_create(
  415.               MENU_STRINGS,         "21", 0,
  416.         MENU_NOTIFY_PROC,    menu_return_item,
  417.         0);
  418. }
  419.  
  420. void
  421. init_login_menu()
  422. {
  423.    login_menu = menu_create(
  424.            MENU_STRINGS,         def_user, "anonymous", 0,
  425.         MENU_NOTIFY_PROC,    menu_return_item,
  426.         0);
  427. }
  428.  
  429. void
  430. init_dir_menu()
  431. {
  432.    dir_menu = menu_create(
  433.               MENU_STRINGS,         def_dir, 0,
  434.         MENU_NOTIFY_PROC,    menu_return_item,
  435.         0);
  436. }
  437.  
  438. void
  439. init_passw_menu()
  440. {
  441.    passw_menu = menu_create(
  442.               MENU_STRINGS,         "guest", 0,
  443.         MENU_NOTIFY_PROC,    menu_return_item,
  444.         0);
  445. }
  446.  
  447. void
  448. init_src_file_menu()
  449. {
  450.    src_file_menu = menu_create(
  451.            MENU_GEN_PROC,        src_file_proc,
  452.         MENU_NOTIFY_PROC,    menu_return_item,
  453.         0);
  454. }
  455.  
  456. static void
  457. init_save_menu()
  458. {
  459.    save_menu = menu_create(
  460.            MENU_GEN_PROC,        save_file_proc,
  461.         MENU_NOTIFY_PROC,    menu_return_item,
  462.         0);
  463. }
  464.  
  465. boolean
  466. host_okay(h)
  467.    char *h;
  468. {
  469.    u_long addr;
  470.    char *cp;
  471.  
  472.    if (!empty_str(h) && resolve_name(h, &addr, 1)) {
  473.       /* Add the host name/number to the menu. */
  474.       if (host_menu && !menu_find(host_menu, MENU_STRING, h, 0)) {
  475.      cp = malloc(strlen(h));
  476.      strcpy(cp, h);
  477.      menu_set(host_menu, MENU_STRING_ITEM, cp, 0, 0);
  478.          }
  479.       return(TRUE);
  480.       }
  481.    else
  482.      return(FALSE);
  483. }
  484.  
  485.  
  486. void
  487. init_host_menu()
  488. {
  489.    FILE *listp;
  490.    char filename[100], hostname[80];
  491.  
  492.    host_menu = menu_create(
  493.               MENU_STRINGS,         def_hostname, 0,
  494.         MENU_NOTIFY_PROC,    menu_return_item,
  495.         0);
  496.         
  497.    /* Read in hosts for menu from file bftp.allhosts */
  498.    sprintf(filename,"%smbftp.allhosts", bftp_dir);
  499.    listp = fopen(filename, "r");
  500.    if (listp == NULL) {
  501.       sprintf(filename,"%sbftp.allhosts", bftp_dir);
  502.       listp = fopen(filename, "r");
  503.       }
  504.    if (listp != NULL) {
  505.       while (fgets(hostname, sizeof(hostname), listp) != NULL) {
  506.      if (hostname[strlen(hostname)-1] == '\n')
  507.         hostname[strlen(hostname)-1]= '\0';
  508.      (void)host_okay(hostname);
  509.      }
  510.       fclose(listp);
  511.       }
  512. }
  513.  
  514. int
  515. find_errors(sw, src, dst, fil)
  516.    Textsw sw;
  517.    struct hostinfo *src, *dst;
  518.    struct fileinfo *fil;
  519. {
  520.    int count = 0;
  521.    char errstr[80];
  522.  
  523. #define print_sw(str)  (void)textsw_insert(sw, str, strlen(str));
  524.  
  525.    print_sw("Checking parameters...\n");
  526.  
  527.    /* check that host numbers are not zero */
  528.    if (!host_okay(src->host)) {
  529.       print_sw("    Error: Illegal source host number.\n");
  530.       count++;
  531.       }
  532.  
  533.    if ((fil->reqtype != DFILE) && !host_okay(dst->host)) {
  534.       print_sw("    Error: Illegal destination host number.\n");
  535.       count++;
  536.       }
  537.  
  538.    if (empty_str(src->user)) {
  539.       print_sw("    Error: Source user name must be specified.\n");
  540.       count++;
  541.       }
  542.    if ((fil->reqtype != DFILE) && empty_str(dst->user)) {
  543.       print_sw("    Error: Destination user name must be specified.\n");
  544.       count++;
  545.       }
  546.    if (empty_str(src->file)) {
  547.       print_sw("    Error: Source file name must be specified.\n");
  548.       count++;
  549.       }
  550.    if (!fil->multflag && (fil->reqtype != DFILE) && 
  551.        empty_str(dst->file)) {
  552.       count++;
  553.       print_sw("    Error: Destination file name must be specified.\n");
  554.       }
  555.  
  556.    if (count) {
  557.       sprintf(errstr,"    Error count = %d\n",count);
  558.       print_sw(errstr);
  559.       }
  560.  
  561.    return(count);
  562. } /* find_errors */
  563.  
  564. int type_choice(value)
  565.    int value;
  566. {  return((value==ASCII)? 0:
  567.           (value==EBCDIC)? 1:
  568.        (value==IMAGE)? 2:
  569.        (value==LOCAL)? 3: 0);
  570. }
  571. int type_value(choice)
  572.    int choice;
  573. {  return((choice==0)? ASCII:
  574.           (choice==1)? EBCDIC:
  575.        (choice==2)? IMAGE: LOCAL);
  576. }
  577. int form_choice(value)
  578.    int value;
  579. {
  580.    return((value==NONPRINT)? 0:
  581.           (value==TELNET)? 1:
  582.        (value==CCNTRL)? 2: 0);
  583. }
  584. int form_value(choice)
  585.    int choice;
  586. {  return((choice==0)? NONPRINT:
  587.           (choice==1)? TELNET: CCNTRL);
  588. }
  589. int stru_choice(value)
  590.    char value;
  591. {  return((value=='F')? 0:
  592.           (value=='R')? 1:
  593.        (value=='P')? 2: 0);
  594. }
  595. char stru_value(choice)
  596.    int choice;
  597. {  return((choice==0)? 'F':
  598.       (choice==1)? 'R': 'P');
  599. }
  600. int mode_choice(value)
  601.    char value;
  602. {  return((value=='S')? 0:
  603.           (value=='B')? 1:
  604.        (value=='C')? 2: 0);
  605. }
  606. char mode_value(choice)
  607.    int choice;
  608. {  return((choice==0)? 'S':
  609.           (choice==1)? 'B': 'C');
  610. }
  611. int op_choice(value)
  612.    int value;
  613. {  return((value==COPY)? 0:
  614.           (value==MOVE)? 1:
  615.        (value==DFILE)? 2: 0);
  616. }
  617. int op_value(choice)
  618.    int choice;
  619. {  return((choice==0)? COPY: (choice==1)? MOVE: DFILE); }
  620.  
  621. Panel_item
  622.     type_item, format_item, byteSize_item, stru_item, 
  623.       mode_item, stou_item, append_item, multiple_item;
  624.  
  625. int
  626. init_param_help(index)
  627.    int index;
  628. {
  629.    int i = index;
  630.  
  631.    set_ptr(stru_item);
  632.    set_str("Structure may be");
  633.    set_str("  'file', which is used for most transfers,");
  634.    set_str("  'record', or");
  635.    set_str("  'page', for TENEX binary files.");
  636.    last_str();
  637.   
  638.    set_ptr(mode_item);
  639.    set_str("Transfer Mode may be 'stream', 'block', or 'compress'.");
  640.    set_str("  The default is 'stream'.");
  641.    last_str();
  642.  
  643.    set_ptr(type_item);
  644.    set_str("Type may be");
  645.    set_str("  'ascii',  which is used to transfer most text files,");
  646.    set_str("  'ebcdic', for text files on some IBM systems,");
  647.    set_str("  'image',  for most binary files, or");
  648.    set_str("  'local'.  Type 'local' with ByteSize '8' is");
  649.    set_str("            equivalent to the BSD 'tenex' command.");
  650.    last_str();
  651.  
  652.    set_ptr(format_item);
  653.    set_str("Format, which is specified in conjunction with the 'ascii'");
  654.    set_str("  and the 'ebcdic' types, can be 'nonprint', 'telnet', or ");
  655.    set_str(" 'carriage-control'.  The default is 'nonprint'.");
  656.    last_str();
  657.        
  658.    set_ptr(byteSize_item);
  659.    set_str("Byte size is specified in conjunction with the 'local' type.");
  660.    set_str("  The default is 8.");
  661.    last_str();
  662.   
  663.    set_ptr(multiple_item);
  664.    set_str("The Multiple flag specifies that the wildcard character");
  665.    set_str("  '*' will be used to match multiple source file names.");
  666.    set_str("  The default is FALSE.");
  667.    last_str();
  668.  
  669.    set_ptr(append_item);
  670.    set_str("The Append flag specifies that the file will be appended");
  671.    set_str("  to an existing file, rather than copied to a new file,");
  672.    set_str("  on the destination host.  The default is FALSE.");
  673.    last_str();
  674.  
  675.    set_ptr(stou_item);
  676.    set_str("The UniqueFileName flag specifies that the STOU command");
  677.    set_str("  will be used to store the file.  If this command is ");
  678.    set_str("  supported by the receiving host, a unique file name");
  679.    set_str("  will be created.  The default is FALSE.");
  680.    last_str();
  681.  
  682.    return(i);
  683. } /* init_param_help */
  684.  
  685. void
  686. copy_fileparams(fil)
  687.    struct fileinfo *fil;
  688. {
  689.    int type, form, bytesiz;
  690.  
  691.    /* fil->filetype */
  692.    switch (type = type_value((int)panel_get(type_item, PANEL_VALUE))) {
  693.       case ASCII:
  694.       case EBCDIC:
  695.          form = form_value((int)panel_get(format_item, PANEL_VALUE));
  696.      sprintf(fil->filetype,"%c %c",
  697.          (type==ASCII)?'A':'E',
  698.          (form==NONPRINT)?'N':(form==TELNET)?'T':'C');
  699.      break;
  700.       case LOCAL:
  701.      bytesiz =atoi((char *)panel_get(byteSize_item, PANEL_VALUE));
  702.      sprintf(fil->filetype, "L %d", bytesiz);
  703.      break;
  704.       case IMAGE:
  705.      strcpy(fil->filetype, "I");
  706.      break;
  707.       };
  708.    fil->stru = stru_value((int)panel_get(stru_item, PANEL_VALUE));
  709.    fil->mode = mode_value((int)panel_get(mode_item, PANEL_VALUE));
  710.    fil->reqtype = COPY;
  711.    fil->creation =
  712.       (((int)panel_get(stou_item, PANEL_VALUE))?
  713.           STOU:
  714.        ((int)panel_get(append_item, PANEL_VALUE))?
  715.         APPE: STOR);
  716.    fil->multflag =
  717.       ((int)panel_get(multiple_item, PANEL_VALUE))? TRUE: FALSE;
  718. } /* copy_fileparams */
  719.  
  720. /* Notify Procs for Parameters Subwindow */
  721.  
  722. void
  723. multiple(item, value, event)
  724.    Panel_item item;
  725.    int value;
  726.    Event *event;
  727. {
  728.    if (value) {
  729.       if (!(int)panel_get(append_item, PANEL_VALUE))
  730.      show_dest_file(FALSE);
  731.       }
  732.    else
  733.       show_dest_file(TRUE);
  734. }
  735.  
  736. void
  737. stou_off(item, value, event)
  738.    Panel_item item;
  739.    int value;
  740.    Event *event;
  741. {
  742.    if (value) {
  743.       panel_set(stou_item, PANEL_VALUE, FALSE,0);
  744.       show_dest_file(TRUE);
  745.       }
  746.    else
  747.       if ((int)panel_get(multiple_item, PANEL_VALUE))
  748.      show_dest_file(FALSE);
  749. }
  750.  
  751. void
  752. append_off(item, value, event)
  753.    Panel_item item;
  754.    int value;
  755.    Event *event;
  756. {
  757.    if (value) {
  758.       panel_set(append_item, PANEL_VALUE, FALSE,0);
  759.       if ((int)panel_get(multiple_item, PANEL_VALUE))
  760.      show_dest_file(FALSE);
  761.       }
  762. }
  763.  
  764. void
  765. page_proc(item, value, event)
  766.    Panel_item item;
  767.    int value;
  768.    Event *event;
  769. {
  770.    if (value == stru_choice('P')) {
  771.       panel_set(format_item, PANEL_SHOW_ITEM, FALSE, 0);
  772.       panel_set(mode_item, PANEL_VALUE, mode_choice('S'), 0);
  773.       panel_set(type_item, 
  774.         PANEL_SHOW_ITEM, TRUE, 
  775.         PANEL_VALUE, type_choice(LOCAL), 
  776.         0);
  777.       panel_set(byteSize_item, 
  778.         PANEL_SHOW_ITEM, TRUE,
  779.         PANEL_VALUE, "36", 
  780.         0);
  781.       }
  782. }
  783.  
  784. void
  785. format_proc(item, value, event)
  786.    Panel_item item;
  787.    int value;
  788.    Event *event;
  789. {
  790.    switch (value) {
  791.       case 0: /* ascii */
  792.       case 1: /* ebcdic */
  793.          /* ascii, ebcdic -- Format: nonprint, telnet, carriage-control */
  794.          panel_set(byteSize_item, PANEL_SHOW_ITEM, FALSE, 0);
  795.          panel_set(format_item, PANEL_SHOW_ITEM, TRUE, 0);
  796.          break;
  797.       case 2: /* image */
  798.          /* image -- nothing else */
  799.          panel_set(format_item, PANEL_SHOW_ITEM, FALSE, 0);
  800.      panel_set(byteSize_item, PANEL_SHOW_ITEM, FALSE, 0);
  801.          break;
  802.       case 3: /* local */
  803.          /* local -- ByteSize: <integer> */    
  804.          panel_set(format_item, PANEL_SHOW_ITEM, FALSE, 0);
  805.      panel_set(byteSize_item, PANEL_SHOW_ITEM, TRUE, 0);
  806.          break;
  807.       }
  808. }
  809.  
  810. Attr_avlist 
  811.     stru_attr,
  812.       mode_attr,
  813.       type_attr,
  814.     form_attr,
  815.     byte_attr,
  816.     mult_attr,
  817.     app_attr,
  818.     stou_attr,
  819.  
  820.       host_attr,
  821.     port_attr,
  822.     login_attr,
  823.     pass_attr,
  824.     dir_attr,
  825.     file_attr;
  826.  
  827. void
  828. init_attr_lists()
  829. {
  830.    stru_attr = attr_create_list(
  831.            PANEL_LABEL_STRING,    "Structure:",
  832.         PANEL_CHOICE_STRINGS,     "file", "record", "page", 0,
  833.         PANEL_VALUE,        stru_choice('F'),
  834.         PANEL_DISPLAY_LEVEL,    PANEL_CURRENT,
  835.         PANEL_EVENT_PROC,    dummy_event_proc,
  836.         PANEL_NOTIFY_PROC,    page_proc,
  837.         0);
  838.    mode_attr = attr_create_list(
  839.            PANEL_LABEL_STRING,    "Mode:",
  840.         PANEL_CHOICE_STRINGS,     "stream", "block", "compress", 0,
  841.         PANEL_VALUE,        mode_choice('S'),
  842.         PANEL_DISPLAY_LEVEL,    PANEL_CURRENT,
  843.         PANEL_EVENT_PROC,    dummy_event_proc,
  844.         0);
  845.    type_attr = attr_create_list(
  846.            PANEL_LABEL_STRING,    "Type:",
  847.         PANEL_CHOICE_STRINGS,     "ascii","ebcdic","image","local",0,
  848.         PANEL_VALUE,        type_choice(ASCII),
  849.         PANEL_DISPLAY_LEVEL,    PANEL_CURRENT,
  850.         PANEL_EVENT_PROC,    dummy_event_proc,
  851.         PANEL_NOTIFY_PROC,    format_proc,
  852.         0);
  853.    form_attr = attr_create_list(
  854.            PANEL_LABEL_STRING,    "Format:",
  855.         PANEL_CHOICE_STRINGS,     "nonprint", "telnet",
  856.                     "carriage-control",0,
  857.         PANEL_VALUE,        form_choice(NONPRINT),
  858.         PANEL_DISPLAY_LEVEL,    PANEL_CURRENT,
  859.         PANEL_EVENT_PROC,    dummy_event_proc,
  860.         0);
  861.    byte_attr = attr_create_list(
  862.            PANEL_LABEL_STRING,    "ByteSize:",
  863.         PANEL_VALUE_DISPLAY_LENGTH, 5,
  864.         PANEL_VALUE,        "8",
  865.         PANEL_SHOW_ITEM,    FALSE,
  866.         PANEL_EVENT_PROC,    check_decimal,
  867.         0);
  868.    mult_attr = attr_create_list(
  869.            PANEL_LABEL_STRING,    "Multiple:",
  870.         PANEL_CHOICE_STRINGS,     "FALSE", "TRUE", 0,
  871.         PANEL_VALUE,        0,
  872.         PANEL_DISPLAY_LEVEL,    PANEL_CURRENT,
  873.         PANEL_EVENT_PROC,    dummy_event_proc,
  874.         PANEL_NOTIFY_PROC,      multiple,
  875.         0);
  876.    app_attr = attr_create_list(
  877.            PANEL_LABEL_STRING,    "AppendFile:",
  878.         PANEL_CHOICE_STRINGS,     "FALSE", "TRUE", 0,
  879.         PANEL_VALUE,        0,
  880.         PANEL_DISPLAY_LEVEL,    PANEL_CURRENT,
  881.         PANEL_EVENT_PROC,    dummy_event_proc,
  882.         PANEL_NOTIFY_PROC,    stou_off,
  883.         0);
  884.    stou_attr = attr_create_list(
  885.            PANEL_LABEL_STRING,    "UniqueFileName:",
  886.         PANEL_CHOICE_STRINGS,     "FALSE", "TRUE", 0,
  887.         PANEL_VALUE,        0,
  888.         PANEL_DISPLAY_LEVEL,    PANEL_CURRENT,
  889.         PANEL_EVENT_PROC,    dummy_event_proc,
  890.         PANEL_NOTIFY_PROC,    append_off,
  891.         0);
  892.  
  893.    host_attr = attr_create_list(
  894.            PANEL_LABEL_STRING,    "Host:",
  895.         PANEL_VALUE_DISPLAY_LENGTH, 24,
  896.         PANEL_EVENT_PROC,    display_host_menu,
  897.         0);
  898.    port_attr = attr_create_list(
  899.            PANEL_LABEL_STRING,    "Port:",
  900.         PANEL_VALUE_DISPLAY_LENGTH, 5,
  901.         PANEL_VALUE,        "21",
  902.         PANEL_EVENT_PROC,    display_port_menu,
  903.         0);
  904.    login_attr = attr_create_list(
  905.            PANEL_LABEL_STRING,    "Login:",
  906.         PANEL_VALUE_DISPLAY_LENGTH, 24,
  907.         PANEL_EVENT_PROC,    display_login_menu,
  908.         0);
  909.    pass_attr = attr_create_list(
  910.            PANEL_LABEL_STRING,    "Pass:",
  911.         PANEL_VALUE_DISPLAY_LENGTH, 2,
  912.         PANEL_MASK_CHAR,    ' ',
  913.         PANEL_EVENT_PROC,    display_passw_menu,
  914.         0);
  915.    dir_attr = attr_create_list(
  916.            PANEL_LABEL_STRING,    "Dir: ",
  917.         PANEL_VALUE_DISPLAY_LENGTH, 24,
  918.         PANEL_EVENT_PROC,    no_spaces,
  919.         0);
  920.    file_attr = attr_create_list(
  921.            PANEL_LABEL_STRING,    "File:",
  922.         PANEL_VALUE_DISPLAY_LENGTH, 24,
  923.         PANEL_EVENT_PROC,    no_spaces,
  924.         0);
  925. }
  926.  
  927. /* These procedures handle the LoadReq, StoreReq, and PurgeReq commands. */
  928.  
  929. Panel_item request_item, quit_item, load_item, store_item, purge_item, msg_item;
  930.  
  931. static int rFrame_X, rFrame_Y;
  932. static Frame rFrame;
  933. extern void update_screen();
  934.  
  935. int
  936. init_req_help(index)
  937.    int index;
  938. {
  939.    int i = index;
  940.  
  941.    set_ptr(load_item);
  942.    set_str("LoadReq is used to read in a request file as the current request.");
  943.    last_str();
  944.  
  945.    set_ptr(store_item);
  946.    set_str("StoreReq is used to save a request in a file.");
  947.    last_str();
  948.  
  949.    set_ptr(purge_item);
  950.    set_str("PurgeReq is used to delete a request file.");
  951.    last_str();
  952.  
  953.    set_ptr(request_item);
  954.    set_str("RequestName refers to a request saved in a file for future use.");
  955.    set_str("  Depress the right mouse button for a list of requests that can be");
  956.    set_str("  read in using the LoadReq command.  Type a new name before writing");
  957.    set_str("  out a request using the StoreReq command.  Request-files are stored");
  958.    set_str("  in the user-defined BFTP directory; for example, request 'name' might");
  959.    set_str("  be saved as '/usr/login/.bftp/bftp-save.name'.");
  960.    last_str();
  961.  
  962.    return(i);
  963. } /* init_req_help */
  964.  
  965. /* Routines for confirmation of the deletion of save files. */
  966.  
  967. static void
  968. yes_or_no(item, event)
  969.    Panel_item item;
  970.    Event *event;
  971. {
  972.    window_return(panel_get(item, PANEL_CLIENT_DATA));
  973. }
  974.  
  975. static Frame
  976. init_confirmer(message)
  977.    char *message;
  978. {
  979.    Frame confirmer;
  980.    Panel c_panel;
  981.  
  982.    confirmer = window_create(rFrame, FRAME,
  983.            FRAME_SHOW_LABEL,     FALSE,
  984.         WIN_X,             0,
  985.         WIN_Y,             0,
  986.         FRAME_NO_CONFIRM,     TRUE,
  987.         0);
  988.    c_panel = window_create(confirmer, PANEL, 0);
  989.    panel_create_item(c_panel, PANEL_MESSAGE, 
  990.        PANEL_LABEL_STRING,     message, 
  991.     0);
  992.    panel_create_item(c_panel, PANEL_BUTTON,
  993.        PANEL_LABEL_X,        ATTR_COL(0),
  994.     PANEL_LABEL_Y,        ATTR_ROW(1),
  995.        PANEL_LABEL_IMAGE, panel_button_image(c_panel, "YES", 3, 0),
  996.     PANEL_CLIENT_DATA, 1,
  997.     PANEL_NOTIFY_PROC, yes_or_no,
  998.     0);
  999.    panel_create_item(c_panel, PANEL_BUTTON,
  1000.        PANEL_LABEL_IMAGE, panel_button_image(c_panel, "NO", 3, 0),
  1001.     PANEL_CLIENT_DATA, 0,
  1002.     PANEL_NOTIFY_PROC, yes_or_no,
  1003.     0);
  1004.    window_fit(c_panel);
  1005.    window_fit(confirmer);
  1006.    return(confirmer);
  1007. }
  1008.  
  1009. boolean
  1010. confirm_yes(message)
  1011.    char *message;
  1012. {
  1013.    Frame confirmer;
  1014.    int answer;
  1015.  
  1016.    confirmer = init_confirmer(message);
  1017.    answer = (int)window_loop(confirmer);
  1018.    window_destroy(confirmer);
  1019.    return(answer);
  1020. }
  1021.  
  1022. void
  1023. update_params(fil)
  1024.    struct fileinfo *fil;
  1025. {
  1026.    char temp[6];
  1027.    int type, form, bytesiz;
  1028.  
  1029.    panel_set(stru_item, PANEL_VALUE, stru_choice(fil->stru), 0);
  1030.    panel_set(mode_item, PANEL_VALUE, mode_choice(fil->mode), 0);
  1031.    panel_set(multiple_item, PANEL_VALUE, fil->multflag, 0);
  1032.    panel_set(stou_item, PANEL_VALUE, (fil->creation==STOU)?TRUE:FALSE, 0);
  1033.    panel_set(append_item, PANEL_VALUE, (fil->creation==APPE)?TRUE:FALSE,
  1034.     0);
  1035.    unpack_filetype(fil->filetype,&type, &form, &bytesiz);
  1036.    panel_set(type_item, PANEL_VALUE, type_choice(type), 0);
  1037.    sprintf(temp, "%d", bytesiz);
  1038.    panel_set(byteSize_item, PANEL_VALUE, temp,
  1039.        PANEL_SHOW_ITEM, (type==LOCAL)?TRUE:FALSE,
  1040.     0);
  1041.    panel_set(format_item,
  1042.     PANEL_VALUE, form_choice(form),
  1043.     PANEL_SHOW_ITEM, ((type==ASCII)||(type==EBCDIC))?TRUE:FALSE,
  1044.     0);
  1045. } /* update_params */
  1046.  
  1047. /* These procedures handle the LoadReq, StoreReq, and PurgeReq commands. */
  1048.  
  1049. static void
  1050. load_proc(item, event)
  1051.    Panel_item item;
  1052.    Event *event;
  1053. {
  1054.    char temp[100], file[100], *cp;
  1055.    struct hostinfo src, dst;
  1056.    struct fileinfo fil;
  1057.    struct reqinfo req;
  1058.  
  1059.    if (empty_str(cp = (char *)panel_get(request_item,PANEL_VALUE)))
  1060.       panel_set(msg_item, 
  1061.         PANEL_LABEL_STRING, "Please specify a RequestName.", 
  1062.         0);
  1063.    else {
  1064.       sprintf(file, "%s.%s", SAVEPREFIX, cp);
  1065.       if (read_req(file, &req, &src, &dst, &fil, temp)) {
  1066.      update_screen(&src, &dst, &fil);
  1067.      panel_set(msg_item, 
  1068.            PANEL_LABEL_STRING, "Request loaded.",
  1069.            0);
  1070.      }
  1071.       else
  1072.      panel_set(msg_item, 
  1073.            PANEL_LABEL_STRING, "Request file not found.",
  1074.            0);
  1075.       }
  1076. }
  1077.  
  1078. static void
  1079. store_proc(item, event)
  1080.    Panel_item item;
  1081.    Event *event;
  1082. {
  1083.    char temp[100], file[100], *cp;
  1084.    struct hostinfo src, dst;
  1085.    struct reqinfo req;
  1086.    struct fileinfo fil;
  1087.    FILE *fp;
  1088.  
  1089.    if (empty_str(cp = (char *)panel_get(request_item,PANEL_VALUE)))
  1090.      panel_set(msg_item, 
  1091.            PANEL_LABEL_STRING, "Please specify a RequestName.",
  1092.            0);
  1093.    else {
  1094.       sprintf(file, "%s.%s", SAVEPREFIX, cp);
  1095.       init_req(&req);
  1096.  
  1097.       copy_screen(&src, &dst, &fil);
  1098.       if ((fp = fopen(file,"r")) != NULL) {
  1099.      fclose(fp);
  1100.      sprintf(temp, "Okay to overwrite %s%s?", bftp_dir, file);
  1101.      if (!confirm_yes(temp)) {
  1102.         panel_set(msg_item, 
  1103.               PANEL_LABEL_STRING, "Request file not stored.",
  1104.               0);
  1105.         return;
  1106.         }
  1107.          }
  1108.       if (write_req(file, &req, &src, &dst, &fil, NULL))
  1109.      panel_set(msg_item, 
  1110.            PANEL_LABEL_STRING, "Request file stored.",
  1111.            0);
  1112.       }
  1113. }
  1114.  
  1115. static void
  1116. purge_proc(item, event)
  1117.    Panel_item item;
  1118.    Event *event;
  1119. {
  1120.    char temp[100], file[100], *cp;
  1121.    FILE *fp;
  1122.  
  1123.    if (empty_str(cp = (char *)panel_get(request_item,PANEL_VALUE)))
  1124.       panel_set(msg_item, 
  1125.         PANEL_LABEL_STRING, "Please specify a RequestName.", 
  1126.         0);
  1127.    else {
  1128.       sprintf(file, "%s.%s", SAVEPREFIX, cp);
  1129.       if ((fp = fopen(file,"r")) != NULL) {
  1130.      fclose(fp);
  1131.      sprintf(temp, "Okay to delete %s%s?", bftp_dir, file);
  1132.      if (!confirm_yes(temp)) {
  1133.         panel_set(msg_item, 
  1134.               PANEL_LABEL_STRING, "Request file not deleted.",
  1135.               0);
  1136.         return;
  1137.         }
  1138.      sprintf(temp, "rm %s 2>&1", file);
  1139.      if (fp = popen(temp,"r")) {
  1140.         if (fgets(temp, sizeof(temp), fp))
  1141.            /* print any errors from rm */
  1142.            panel_set(msg_item, 
  1143.              PANEL_LABEL_STRING, temp,
  1144.              0);
  1145.         else
  1146.            panel_set(msg_item, 
  1147.              PANEL_LABEL_STRING, "Request file deleted.",
  1148.              0);
  1149.         pclose(fp);
  1150.             }
  1151.      }
  1152.       else
  1153.      panel_set(msg_item, 
  1154.            PANEL_LABEL_STRING, "Request file not found.",
  1155.            0);
  1156.       panel_set(request_item, PANEL_VALUE, "", 0);
  1157.       }
  1158. }
  1159.  
  1160. void
  1161. destroy_req_frame()
  1162. {
  1163.    if (rFrame) {
  1164.       menu_destroy(save_menu);
  1165.       window_destroy(rFrame);
  1166.       rFrame = NULL;
  1167.       }
  1168. }
  1169.       
  1170. void
  1171. init_rs_location(win_x,win_y)
  1172.    int win_x,win_y;
  1173. {
  1174.    rFrame_X = win_x;
  1175.    rFrame_Y = win_y;
  1176. }
  1177.  
  1178. static void
  1179. create_request_frame()
  1180. {
  1181.    Window params;
  1182.    int bwidth = 8,
  1183.        row = 0;
  1184.  
  1185.    init_save_menu();
  1186.  
  1187.    rFrame = window_create(tool_frame, FRAME,
  1188.            WIN_X,             rFrame_X,
  1189.         WIN_Y,             rFrame_Y,
  1190.            FRAME_LABEL,         "Request Storage",
  1191.         FRAME_SHOW_LABEL,    TRUE,
  1192.         FRAME_NO_CONFIRM,     TRUE,
  1193.         FRAME_DONE_PROC,        destroy_req_frame,
  1194.         0);
  1195.    params = window_create(rFrame, PANEL,
  1196.            PANEL_ITEM_X_GAP,    15,
  1197.         0);
  1198.         
  1199.    quit_item = panel_create_item(params, PANEL_BUTTON,
  1200.                 PANEL_LABEL_IMAGE,
  1201.             panel_button_image(params, "Quit", 0, 0),
  1202.         PANEL_EVENT_PROC,    dummy_event_proc,
  1203.         PANEL_NOTIFY_PROC,      destroy_req_frame,
  1204.         0);
  1205.    load_item = panel_create_item(params, PANEL_BUTTON,
  1206.            PANEL_LABEL_IMAGE,
  1207.             panel_button_image(params, "LoadReq", bwidth, 0),
  1208.         PANEL_EVENT_PROC,    dummy_event_proc,
  1209.         PANEL_NOTIFY_PROC,    load_proc,
  1210.         0);
  1211.    store_item = panel_create_item(params, PANEL_BUTTON,
  1212.            PANEL_LABEL_IMAGE,
  1213.             panel_button_image(params, "StoreReq", bwidth, 0),
  1214.         PANEL_EVENT_PROC,    dummy_event_proc,
  1215.         PANEL_NOTIFY_PROC,    store_proc,
  1216.         0);
  1217.    purge_item = panel_create_item(params, PANEL_BUTTON,
  1218.            PANEL_LABEL_IMAGE,
  1219.             panel_button_image(params, "PurgeReq", bwidth, 0),
  1220.         PANEL_EVENT_PROC,    dummy_event_proc,
  1221.         PANEL_NOTIFY_PROC,    purge_proc,
  1222.         0);
  1223.    request_item = panel_create_item(params, PANEL_TEXT,
  1224.            PANEL_LABEL_X,        ATTR_COL(0),
  1225.         PANEL_LABEL_Y,        (ATTR_ROW(++row)+(row*8)),
  1226.            PANEL_LABEL_STRING,    "RequestName:",
  1227.         PANEL_VALUE_DISPLAY_LENGTH, 24,
  1228.         PANEL_EVENT_PROC,    display_save_menu,
  1229.         0);
  1230.    msg_item =   panel_create_item(params, PANEL_MESSAGE, 
  1231.             PANEL_LABEL_X,        ATTR_COL(0),
  1232.             PANEL_LABEL_Y,          (ATTR_ROW(++row)+(row*8)),
  1233.             PANEL_LABEL_STRING,     " ", 
  1234.         0);
  1235.         
  1236.    window_fit(params);
  1237.    window_fit(rFrame);
  1238.    window_set(rFrame, WIN_SHOW, TRUE, 0);
  1239. } /* create_request_frame */
  1240.  
  1241. void
  1242. rStorage_proc(item, event)
  1243.    Panel_item item;
  1244.    Event *event; 
  1245. {
  1246.    if (rFrame) 
  1247.       destroy_req_frame();
  1248.    else
  1249.       create_request_frame();
  1250. }
  1251.  
  1252. /* Submit Popup Window */
  1253.  
  1254. extern void quit_popup(), do_submit();
  1255.  
  1256. Window popup_frame;
  1257. Textsw fts_sw;
  1258. Panel_item 
  1259.   quitSW_item, keyword_item, queue_item,
  1260.   interval_item, tries_item, startTime_item,
  1261.   mailbox_item;
  1262.  
  1263. int
  1264. init_submit_help(index)
  1265.    int index;
  1266. {
  1267.   int i = index;
  1268.  
  1269.    set_ptr(quitSW_item);
  1270.    set_str("Quit is used to exit this command, destroying this popup window.");
  1271.    last_str();
  1272.  
  1273.    set_ptr(queue_item);
  1274.    set_str("QueueRequest queues the current request, which will");
  1275.    set_str("  be first attempted at the specified start time.");
  1276.    last_str();
  1277.  
  1278.    set_ptr(mailbox_item);
  1279.    set_str("The Mailbox is the address where the report on the outcome of the");
  1280.    set_str("  transfer will be sent.  The basic format is 'user@domain',");
  1281.    set_str("   e.g. 'smith@isi.edu'.");
  1282.    last_str();
  1283.  
  1284.    set_ptr(keyword_item);
  1285.    set_str("The RequestKeyword, which is made up by the person submitting a");
  1286.    set_str("  request, is checked when the BFTP/BFTPTOOL 'Find' command is");
  1287.    set_str("  used to find a previous request and/or to cancel it.");
  1288.    set_str("  This field may be left blank.");
  1289.    last_str();
  1290.  
  1291.    set_ptr(interval_item);
  1292.    set_str("The Interval represents the starting interval for how often the");
  1293.    set_str("  transfer will be retried (in minutes).  The retry interval will");
  1294.    set_str("  be doubled on each successive retry until the maximum interval,");
  1295.    set_str("  4 hours, is reached.  The default starting interval is 15 minutes.");
  1296.    last_str();
  1297.  
  1298.    set_ptr(tries_item);
  1299.    set_str("The MaxTries parameter represents the maximum number of times that");
  1300.    set_str("  the BFTP server will attempt the transfer before giving up.");
  1301.    set_str("  The default is 5 times.");
  1302.    last_str();
  1303.  
  1304.    set_ptr(startTime_item);
  1305.    set_str("The StartTime is the time that the transfer will be attempted for");
  1306.    set_str("  the first time, for example '4 July 2001 4:01pm', or simply");
  1307.    set_str("  '16:01', meaning today at 4:01 PM.  The default is 'now', which");
  1308.    set_str("  is interpretted as the current date and time.");
  1309.    last_str();
  1310.  
  1311.    return(i);
  1312. } /* init_submit_help */
  1313.  
  1314. Notify_value
  1315. close_popup(frame, status)
  1316.    Frame frame;
  1317.    Destroy_status status;
  1318. {
  1319.    quit_popup();
  1320. }
  1321.  
  1322. void
  1323. make_submit_frame(req, t_width, t_lines, x_loc, y_loc)
  1324.    struct reqinfo *req;
  1325.    int t_width, t_lines, x_loc, y_loc;
  1326. {
  1327.    Window sw_panel;
  1328.    int row = 0;
  1329.    char temp[6];
  1330.  
  1331.    popup_frame = window_create(tool_frame, FRAME,
  1332.            WIN_X,             x_loc,
  1333.         WIN_Y,             y_loc,
  1334.         FRAME_NO_CONFIRM,     TRUE,
  1335.         FRAME_DONE_PROC,    close_popup,
  1336.         0);
  1337.         
  1338.    sw_panel = window_create(popup_frame, PANEL,
  1339.            0);
  1340.    quitSW_item = panel_create_item(sw_panel, PANEL_BUTTON,
  1341.                 PANEL_LABEL_IMAGE,
  1342.             panel_button_image(sw_panel, "Quit", 0, 0),
  1343.         PANEL_EVENT_PROC,    dummy_event_proc,
  1344.         PANEL_NOTIFY_PROC,      quit_popup,
  1345.         0);
  1346.    queue_item = panel_create_item(sw_panel, PANEL_BUTTON,
  1347.                 PANEL_LABEL_IMAGE,
  1348.             panel_button_image(sw_panel, "QueueRequest", 0, 0),
  1349.         PANEL_EVENT_PROC,    dummy_event_proc,
  1350.         PANEL_NOTIFY_PROC,      do_submit,
  1351.         0);
  1352.  
  1353.    startTime_item = panel_create_item(sw_panel, PANEL_TEXT,
  1354.            PANEL_LABEL_X,        ATTR_COL(0),
  1355.         PANEL_LABEL_Y,        ATTR_ROW(++row),
  1356.            PANEL_LABEL_STRING,    "StartTime:",
  1357.         PANEL_VALUE_DISPLAY_LENGTH, 30,
  1358.         PANEL_EVENT_PROC,    dummy_event_proc,
  1359.         PANEL_VALUE,        "now",
  1360.         0);
  1361.    sprintf(temp, "%d", req->interval);
  1362.    interval_item = panel_create_item(sw_panel, PANEL_TEXT,
  1363.            PANEL_LABEL_X,        ATTR_COL(0),
  1364.         PANEL_LABEL_Y,        ATTR_ROW(++row),
  1365.            PANEL_LABEL_STRING,    "Interval:",
  1366.         PANEL_VALUE_STORED_LENGTH, 3,
  1367.         PANEL_VALUE_DISPLAY_LENGTH, 3,
  1368.         PANEL_EVENT_PROC,    check_decimal,
  1369.         PANEL_VALUE,        temp,
  1370.         0);
  1371.    panel_create_item(sw_panel, PANEL_MESSAGE,
  1372.            PANEL_LABEL_STRING,     "minutes ",
  1373.         0);
  1374.    sprintf(temp, "%d", req->ntries);
  1375.    tries_item = panel_create_item(sw_panel, PANEL_TEXT,
  1376.            PANEL_LABEL_STRING,    "MaxTries:",
  1377.         PANEL_VALUE_STORED_LENGTH, 3,
  1378.         PANEL_VALUE_DISPLAY_LENGTH, 3,
  1379.         PANEL_EVENT_PROC,    check_decimal,
  1380.         PANEL_VALUE,        temp,
  1381.         0);
  1382.    mailbox_item = panel_create_item(sw_panel, PANEL_TEXT,
  1383.            PANEL_LABEL_X,        ATTR_COL(0),
  1384.         PANEL_LABEL_Y,        ATTR_ROW(++row),
  1385.            PANEL_LABEL_STRING,    "Mailbox:",
  1386.         PANEL_VALUE_DISPLAY_LENGTH, 40,
  1387.         PANEL_VALUE,        req->mailbox,
  1388.         PANEL_EVENT_PROC,    no_spaces,
  1389.         0);
  1390.    keyword_item = panel_create_item(sw_panel, PANEL_TEXT,
  1391.            PANEL_LABEL_X,        ATTR_COL(0),
  1392.         PANEL_LABEL_Y,        ATTR_ROW(++row),
  1393.            PANEL_LABEL_STRING,    "RequestKeyword:",
  1394.         PANEL_VALUE_DISPLAY_LENGTH, 20,
  1395.         PANEL_EVENT_PROC,    make_bold,
  1396.         PANEL_MASK_CHAR,    ' ',
  1397.         PANEL_LABEL_BOLD,       (strlen(req->rpasswd))?TRUE:FALSE,
  1398.         PANEL_VALUE,        req->rpasswd,
  1399.         0);
  1400.    window_fit(sw_panel);
  1401.    window_fit_width(popup_frame);
  1402.  
  1403.    fts_sw = window_create(popup_frame, TEXTSW,
  1404.               WIN_WIDTH,        ATTR_COL(t_width),
  1405.               WIN_HEIGHT,           ATTR_ROW(t_lines),
  1406.               TEXTSW_IGNORE_LIMIT,  TEXTSW_INFINITY,
  1407.               TEXTSW_READ_ONLY,     TRUE,
  1408.               0);
  1409.    window_fit(fts_sw);
  1410.    window_fit(popup_frame);
  1411.  
  1412.    window_set(popup_frame, WIN_SHOW, TRUE, 0);
  1413. } /* make_submit_frame */
  1414.  
  1415. /* General Purpose Popup Window */
  1416.  
  1417. make_fts_frame(name, t_width, t_lines, x_loc, y_loc)
  1418.    char *name;
  1419.    int t_width, t_lines, x_loc, y_loc;
  1420. {
  1421.    Window sw_panel;
  1422.  
  1423.    popup_frame = window_create(tool_frame, FRAME,
  1424.            WIN_X,            x_loc,
  1425.         WIN_Y,            y_loc,
  1426.            FRAME_LABEL,         name,
  1427.         FRAME_SHOW_LABEL,       TRUE,
  1428.         FRAME_NO_CONFIRM,     TRUE,
  1429.         FRAME_DONE_PROC,    close_popup,
  1430.         0);
  1431.         
  1432.    sw_panel = window_create(popup_frame, PANEL,
  1433.            0);
  1434.    quitSW_item = panel_create_item(sw_panel, PANEL_BUTTON,
  1435.                 PANEL_LABEL_IMAGE,
  1436.             panel_button_image(sw_panel, "Quit", 0, 0),
  1437.         PANEL_EVENT_PROC,    dummy_event_proc,
  1438.         PANEL_NOTIFY_PROC,      quit_popup,
  1439.         0);
  1440.    window_fit(sw_panel);
  1441.    window_fit_width(popup_frame);
  1442.  
  1443.    fts_sw = window_create(popup_frame, TEXTSW,
  1444.         WIN_WIDTH,        ATTR_COL(t_width),
  1445.          WIN_HEIGHT,        ATTR_ROW(t_lines),
  1446.         TEXTSW_IGNORE_LIMIT,    TEXTSW_INFINITY,
  1447.            TEXTSW_READ_ONLY,     TRUE,
  1448.         0);
  1449.     
  1450.    window_fit(fts_sw);
  1451.    window_fit(popup_frame);
  1452.  
  1453.    window_set(popup_frame, WIN_SHOW, TRUE, 0);
  1454. } /* make_fts_frame */
  1455.